package Test_319_3;

import java.util.Random;

public class Rectangle extends Shape{

    double width;//长
    double height;//宽

    public Rectangle(){
        System.out.println("===Rectangle类默认构造方法===");
    }

    public Rectangle(double width,double height, String color){
        super(color);//继承父类的color属性
        this.width = width;
        this.height = height;
        System.out.println("Rectangle类三个参数的构造方法");
    }

    @Override
    public double gerArea() {
        area = width*height;
        return area;
    }

    @Override
    public double getPer() {
        per  = 2*(width+height);
        return per;
    }

    //获取所有信息
    @Override
    public void showAll() {
        System.out.println("矩形的长："+height);
        System.out.println("矩形的宽："+width);
        System.out.println("矩形的颜色："+getColor());
        System.out.println("矩形的面积："+gerArea());
        System.out.println("矩形的周长："+getPer());

    }
}
